Synonyms tell Algolia which words and expressions to consider equal.
["pants", "trousers", "slacks"]
, a search for “trousers” returns records with “pants” or “slacks”, and a search for “pants” returns records with “trousers” or “slacks”.
Regular synonyms can be represented by the following JSON:
Alternative correction type | Query | Results order |
---|---|---|
One typo | trousers | 1. trousers (0 typos) 2. pants |
Two typos | pants | 1. pants (0 typos) 2. panto (1 typo) 3. trousers (2 typos) |
<model>
placeholder to your records.
sku
), <model>
can be replaced by “13” or “14” (since the iPhone 13 and 14 have similar dimensions, some cases will fit both versions).
Searches for “case iPhone 13” or “case iPhone 14” return the same record, with <model>
replaced by the number in the search query.
A placeholder synonym can be represented by the following JSON:
distinct
parameter to deduplicate the variations.
For more information, see Grouping results.
"boot","shoe"
:
pants ⇔ trousers
and trousers ⇒ slacks
,
a search for “pants” matches “trousers”, but doesn’t match “slacks”.
If you want cascading behavior, create a list of regular synonyms, such as pants ⇔ trousers ⇔ slacks
.
In this example, a search for “pants” matches “trousers” and “slacks”.
sneakers ⇔ baskets
.
Users searching for “sneaker” might see an odd mix of high-top basketball sneakers and hand-knit storage baskets.photocopier ⇔ xerox
: a “photocopier” search might show many “Xerox” results,
and a search for “xerox” might show many non-Xerox photocopiers.HD ⇔ High Definition
and search for HD
,
the search first matches records with “High Definition”, but doesn’t match records with “High Resolution Definition” or “Definition High”.
trousers ⇔ pants
.
If you accept the suggestion, a new synonym is added automatically.